package com.hdjk.view.callback;

import com.hdjk.view.entity.RiskTestReturnEntity;
import com.lst.projectlib.entity.Msg;

import org.json.JSONObject;

import okhttp3.Response;

/**
 * Created by sxy on 2017/11/2.
 */

public abstract class GetRiskTestDescCallBack extends MsgCallBack {
    @Override
    public Msg parseNetworkResponse(Response response, int i) throws Exception {
        Msg msg = super.parseNetworkResponse(response, i);
        JSONObject object = (JSONObject) msg.getData();
        if (object!=null) {
            RiskTestReturnEntity entity = new RiskTestReturnEntity();
            if (!object.isNull("riskAppetite")) {
                entity.setRiskAppetite(object.getString("riskAppetite"));
            }
            if (!object.isNull("riskRating")) {
                entity.setRiskRating(object.getString("riskRating"));
            }
            if (!object.isNull("riskDescription_point")) {
                entity.setPoint(object.getString("riskDescription_point"));
            }
            if (!object.isNull("riskDescription_title")) {
                entity.setTitle(object.getString("riskDescription_title"));
            }
            msg.setData(entity);
        }
        return msg;
    }
}
